<?php

class Controller
{
	protected $model;
	protected $controller;
	protected $action;
	protected $view;
	protected $modelBaseName;
	
	//The constructor sets a default view to /views/MODEL_BASE_NAME/ACTION_NAME, so, 
	//for example default view for a NewsController controller and a index action would 
	//be: /views/news/index.tpl. The Controller class also enables us to setup our own 
	//View via the _setView() method.
	
	public function __construct($model, $action)
	{
		$this->controller = ucwords(__CLASS__);
		$this->action = $action;
		$this->modelBaseName = $model;
	}
	
	protected function setModel($modelName)
	{
		$modelName .= 'Model';
		$this->model = new $modelName();
	}
	
	protected function setView($viewName)
	{
		$viewName .= 'View';
		$this->view = new View(HOME . DS . 'views' . DS . strtolower($this->modelBaseName). DS . $viewName . '.tpl');
	}
	
}